package com.lhys.mapper;

import com.lhys.pojo.AssetStorage;
import com.lhys.pojo.AssetStorage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 资产_存放处表 Mapper 接口
 * </p>
 *
 * @author 小七
 * @since 2021-05-06
 */
public interface AssetStorageMapper {
    @Insert("INSERT INTO asset_storage(asset_user_id, title, code, asset_type_id, status, remark, create_time) VALUES (#{assetUserId}, #{title}, #{code}, #{assetTypeId}, #{status}, #{remark}, #{createTime})")
    Integer addAssetStorage(AssetStorage assetStorage);

    @Delete("delete from asset_storage where id = #{id}")
    Integer delAssetStorage(Integer id);

    Integer updateAssetStorage(AssetStorage assetStorage);

    @Select("select * from asset_storage where id = #{id}")
    AssetStorage getAssetStorageById(Integer id);

    @Select("select * from asset_storage where asset_user_id = #{id}")
    AssetStorage getAssetStorageByUserId(Integer id);

    @Select("select * from asset_storage where code = #{code}")
    AssetStorage getAssetStorageByCode(String code);

    List<AssetStorage> getAssetStorageByStatusAndTitleOrRemarkList(AssetStorage assetStorage);

    @Select("select * from asset_storage where title = #{title}")
    AssetStorage getAssetStorageByTitle(String title);
}
